package com.star.common.exception;

import com.star.common.enums.BizStatus;
import lombok.Getter;

/**
 * 业务异常
 *
 * @author yangzj
 */
@Getter
public class BizException extends RuntimeException {

    private Integer code;

    private BizException() {
    }

    public BizException(String message) {
        super(message);
        this.code = BizStatus.ERROR.getCode();
    }

    public BizException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BizException(BizStatus status) {
        super(status.getMessage());
        this.code = status.getCode();
    }

    public BizException(BizStatus status, String message) {
        super(message);
        this.code = status.getCode();
    }
}
